//
//  MKBottomToolView.m
//  Weibo_OC
//
//  Created by mac on 16/1/23.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "MKBottomToolView.h"
#import "UIButton+MKButton.h"
#import <Masonry.h>


@interface MKBottomToolView ()

@property (strong, nonatomic) UIButton *relayButton;

@property (strong, nonatomic) UIButton *commentButton;

@property (strong, nonatomic) UIButton *likeButton;

@end

@implementation MKBottomToolView

- (instancetype)init {
    if (self = [super init]) {
        [self setupUI];
    }
    
    return self;
}

- (void)setupUI {

    UIView *line1 = [self getLine];
    UIView *line2 = [self getLine];
    
    [self addSubview:self.relayButton];
    [self addSubview:line1];
    [self addSubview:self.commentButton];
    [self addSubview:line2];
    [self addSubview:self.likeButton];
    
    
    [self.relayButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(self.mas_left);
        make.bottom.equalTo(self.mas_bottom);
        make.width.equalTo(self.commentButton.mas_width);
    }];
    
    [line1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(0.5);
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.relayButton.mas_right);
        make.height.equalTo(self.mas_height).multipliedBy(0.6);
    }];
    
    [self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(line1.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.width.equalTo(self.relayButton.mas_width);
        
    }];
    [line2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(0.5);
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.commentButton.mas_right);
        make.height.equalTo(self.mas_height).multipliedBy(0.6);
    }];
    [self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top);
        make.left.equalTo(line2.mas_right);
        make.bottom.equalTo(self.mas_bottom);
        make.width.equalTo(self.commentButton.mas_width);
        make.right.equalTo(self.mas_right);
    }];
    
}

#pragma mark -
#pragma mark - 加载分割线

- (UIView *)getLine {
    UIView *lineView = [[UIView alloc] init];
    lineView.backgroundColor = [UIColor lightGrayColor];
    
    return lineView;
}

#pragma mark -
#pragma mark - 懒加载 转发按钮
-(UIButton *)relayButton {
    if (nil == _relayButton) {
        _relayButton = [[UIButton alloc] initWithTitle:@"转发" andWithImageName:@"timeline_icon_retweet"];
    }
    
    return _relayButton;

}

#pragma mark -
#pragma mark - 懒加载 评论按钮

- (UIButton *)commentButton {
    if (nil == _commentButton) {
        
        _commentButton = [[UIButton alloc] initWithTitle:@"评论" andWithImageName:@"timeline_icon_comment"];
    }
    return _commentButton;
}

#pragma mark -
#pragma mark - 懒加载 赞按钮
- (UIButton *)likeButton {
    if (nil == _likeButton) {
        _likeButton = [[UIButton alloc] initWithTitle:@"赞" andWithImageName:@"timeline_icon_unlike"];
    }
    
    return _likeButton;
}


@end













